home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Leser 19 / Amiga Plus Leser CD 19.iso / Tools / Freeware / Swf_Player / Lib / cxform.cc < prev    next >
Encoding:
C/C++ Source or Header  |  2002-11-17  |  1.8 KB  |  80 lines

  1. /////////////////////////////////////////////////////////////
  2. // Flash Plugin and Player
  3. // Copyright (C) 1998,1999 Olivier Debon
  4. // 
  5. // This program is free software; you can redistribute it and/or
  6. // modify it under the terms of the GNU General Public License
  7. // as published by the Free Software Foundation; either version 2
  8. // of the License, or (at your option) any later version.
  9. // 
  10. // This program is distributed in the hope that it will be useful,
  11. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. // GNU General Public License for more details.
  14. // 
  15. // You should have received a copy of the GNU General Public License
  16. // along with this program; if not, write to the Free Software
  17. // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  18. // 
  19. ///////////////////////////////////////////////////////////////
  20. //  Author : Olivier Debon  <odebon@club-internet.fr>
  21. //  
  22.  
  23. #include "swf.h"
  24.  
  25. #ifdef RCSID
  26. static char *rcsid = "$Id";
  27. #endif
  28.  
  29. long
  30. Cxform::getRed(long v) {
  31.     long val;
  32.  
  33.     val = (long)(ra*v+rb);
  34.     if (val > 255) val = 255;
  35.     else if (val < 0) val = 0;
  36.     return val;
  37. }
  38.  
  39. long
  40. Cxform::getGreen(long v) {
  41.     long val;
  42.  
  43.     val = (long)(ga*v+gb);
  44.     if (val > 255) val = 255;
  45.     else if (val < 0) val = 0;
  46.     return val;
  47. }
  48.  
  49. long
  50. Cxform::getBlue(long v) {
  51.     long val;
  52.  
  53.     val = (long)(ba*v+bb);
  54.     if (val > 255) val = 255;
  55.     else if (val < 0) val = 0;
  56.     return val;
  57. }
  58.  
  59. long
  60. Cxform::getAlpha(long v) {
  61.     long val;
  62.  
  63.     val = (long)(aa*v+ab);
  64.     if (val > 255) val = 255;
  65.     else if (val < 0) val = 0;
  66.     return val;
  67. }
  68.  
  69. Color
  70. Cxform::getColor(Color color) {
  71.     Color newColor;
  72.  
  73.     newColor.red = getRed(color.red);
  74.     newColor.green = getGreen(color.green);
  75.     newColor.blue = getBlue(color.blue);
  76.     newColor.alpha = getAlpha(color.alpha);
  77.  
  78.     return newColor;
  79. }
  80.